<template>
  <div class="search_continer">
    <div class="search_continer_title">查询栏</div>
    <!-- 查询输入项 ----------------------------------------------------------------------------------->
    <div class="search_continer_myInput">
      <el-input v-model="queryParams.pickNum" placeholder="请输入申请单号" />
    </div>
    <div class="search_continer_myInput">
      <el-select v-model="queryParams.type" filterable placeholder="请选择申请类型">
        <el-option v-for="(item, i) in ['维修', '保养', '其他']" :key="i" :label="item" :value="i">
        </el-option>
      </el-select>
    </div>
    <div class="search_continer_myInput">
      <el-select v-model="queryParams.auditStatus" placeholder="请选择我的审核状态" style="width:100%">
        <el-option v-for="(dict, index) in ['待审核', '审核中', '已通过', '已驳回']" :key="index" :label="dict" :value="index + ''">
        </el-option>
      </el-select>
    </div>
    <el-button type="primary" icon="el-icon-search" @click="handleQueryClick">查询</el-button>
    <el-button icon="el-icon-refresh-left" @click="handleReset">重置</el-button>
  </div>
</template>

<script>
export default {
  name: 'SearchBar',
  data () {
    return {
      /** 查询参数 --------------------------------------------------------------------------------- */
      queryParams: {
        pickNum: null,
        type: null,
        auditStatus: null
      },
      /**  ------------------------------------------------------------------------------------------ */
    }
  },
  mounted () {
  },
  methods: {
    handleQueryClick () {
      this.$emit('query_click', this.queryParams)
    },
    handleReset () {
      for (const k in this.queryParams) {
        this.queryParams[k] = null
      }
      this.$emit('reset_click')
    }
  }
}
</script>
<style lang="scss" scoped>
.search_continer {
  padding: 10px;
  margin-bottom: 20px;
  display: flex;
  background-color: white;
  border-radius: 5px;

  &_title {
    line-height: 36px;
    padding: 0 20px 0 0;
    font-weight: bold;
  }

  &_myInput {
    padding-right: 20px;
  }
}
</style>
